/**************
 * render.cpp *
 **************/

// This file contains the entire rendering functionality of the engine.

#include "render.h"

namespace graphics
{
	// The rendering pipeline
	void render(int width, int height)
	{
		// *** render scene image ***
		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
		glPushAttrib(GL_VIEWPORT_BIT);
		glViewport(0,0,width, height);

		glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		gluPerspective(45.0,
						(double)width / (double)height,
						0.01,
						10000000.0);
		glMatrixMode(GL_MODELVIEW);
		// *** render scene image ***

		glBegin(GL_QUADS);
			glColor3f(1.0f, 1.0f, 1.0f);
			glVertex3f(0.5f, 0.5f, -10.0f);
			glVertex3f(-0.5f, 0.5f, -10.0f);
			glVertex3f(-0.5f, -0.5f, -10.0f);
			glVertex3f(0.5f, -0.5f, -10.0f);
		glEnd();
	
		glPopAttrib();
	}

}